<?php
/**
 * Created by PhpStorm
 * User: whh
 * Date: 2022/7/28
 * Time: 16:02
 */

namespace app\common\model;


use app\backstage\model\Backhaul;
use app\backstage\model\ManagerUser;
use think\Model;

class QuickLink extends Model
{
    use Common;

    protected $table = 'quick_link';


    /**
     * 关联快应用
     * @return \think\model\relation\HasOne
     */
    public function quickApp()
    {
        return $this->hasOne(QuickApp::class, 'id', 'quick_id')->field("id,name");
    }


    public function agent()
    {
        return $this->hasOne(ManagerUser::class, 'id', 'agent_id')->field("id,account");
    }

    public function channel()
    {
        return $this->hasOne(ManagerUser::class, 'id', 'channel_id')->field("id,account");
    }


    public function backhaul(){
        return $this->hasOne(Backhaul::class, 'link_id', 'id');
    }

    public function novel()
    {
        return $this->hasOne(Novel::class, 'id', 'novel_id')->field("id,title,cover");
    }

}